﻿using System;
using System.Data;
using Microsoft.AspNetCore.Mvc;

namespace SqlSugar
{
    /// <summary>
    /// SqlSugar 工作单元配置特性
    /// </summary>
    [AttributeUsage(AttributeTargets.Method, Inherited = true)]
    public class UnitOfWorkAttribute : TypeFilterAttribute
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public UnitOfWorkAttribute() : this(IsolationLevel.ReadCommitted) { }

        public UnitOfWorkAttribute(IsolationLevel isolationLevel) : base(typeof(UnitOfWorkFilter))
        {
            Arguments = new object[] { isolationLevel };
        }
    }
}